package com.hsh.maoduo.controller;

import com.hsh.maoduo.common.Result;
import com.hsh.maoduo.pojo.dto.ShopDTO;
import com.hsh.maoduo.pojo.vo.ShopVO;
import com.hsh.maoduo.service.ShopService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/shop")
public class ShopController {


    @Resource
    private ShopService shopService;

    @GetMapping("/list")
    public List<ShopDTO> getList(ShopVO shopVO) {
        return shopService.getList(shopVO);
    }

    @PostMapping("/addOne")
    public Result addOne(ShopVO shopVO) {
        return shopService.addOne(shopVO);
    }

    @PostMapping("/update")
    public Result update(ShopVO shopVO) {
        return shopService.update(shopVO);
    }

    @PostMapping("/delete")
    public Result delete(int id) {
        return shopService.delete(id);
    }
}
